In [1]:
from src.NSGData import NSGData, GaborSystemParams
from src.GaborSystem import Oct
In [36]:
guitar = NSGData.from_wav("./samples/guitar.wav", 
GaborSystemParams(
    scale=Oct,
    n_b=60,
    fmin=30,
    fmax=22000,
    fs=44100,
    Ls=44100,
    reducedform=0
))

guitar.to_tiff("./images/guitar.tiff")

guitar_r = NSGData.from_tiff("./images/guitar.tiff")

guitar.show()
guitar_r.show()

from torch import allclose
allclose(guitar.s, guitar_r.s, atol=1e-7)
torch.Size([2, 575, 87782])
Saved complex spectrogram to ./images/guitar.tiff with (2, 575, 87782) shape
Importing tiff c with shape:  torch.Size([2, 575, 87782])
torch.Size([575, 87782])
Out[36]:
True
No description has been provided for this image
No description has been provided for this image

Vocal repair¶

In [2]:
bad_vocal = NSGData.from_wav("./samples/bad_vocal.wav", 
GaborSystemParams(
    scale=Oct,
    n_b=48,
    fmin=10,
    fmax=24000,
    fs=None,
    Ls=None,
    reducedform=0
))

bad_vocal.to_tiff("./images/bad_vocal.tiff")
bad_vocal.show()
c:\Projects\nsgt-3\src\frame.py:83: UserWarning: Q-factor too high for frequencies 10.00,10.15,10.29,10.44,10.59,10.75,10.91,11.06,11.22,11.39,11.55,11.72,11.89,12.06,12.24,12.42,12.60,12.78,12.97,13.16,13.35,13.54,13.74,13.94,14.14,14.35,14.56,14.77,14.98,15.20,15.42,15.65,15.87,16.10,16.34,16.58,16.82,17.06,17.31,17.56,17.82,18.08,18.34,18.61,18.88,19.15,19.43,19.71,20.00,20.29,20.59,20.88,21.19,21.50,21.81,22.13,22.45,22.78,23.11,23.44,23.78,24.13,24.48,24.84,25.20,25.56,25.94,26.31,26.70,27.08,27.48,27.88,28.28,28.69,29.11,29.54,29.97,30.40,30.84,31.29,31.75,32.21,32.68,33.15,33.63,34.12,34.62,35.12,35.63,36.15,36.68,37.21,37.75,38.30,38.86,39.42,40.00,40.58,41.17,41.77,42.38,42.99,43.62,44.25,44.90,45.55,46.21,46.88,47.57,48.26,48.96,49.67,50.39,51.13,51.87,52.63,53.39,54.17,54.96,55.75,56.57,57.39,58.22,59.07,59.93,60.80,61.68,62.58,63.49,64.42,65.35,66.30,67.27,68.25,69.24,70.25,71.27,72.30,73.36,74.42,75.50,76.60,77.72,78.85,79.99,81.16,82.34,83.54,84.75,85.98,87.23,88.50,89.79,91.10,92.42,93.77,95.13,96.51,97.92,99.34,100.79,102.25,103.74,105.25,106.78
  warn("Q-factor too high for frequencies %s"%",".join("%.2f"%fi for fi in f[q >= qneeded]))
torch.Size([2, 542, 1749])
Saved complex spectrogram to ./images/bad_vocal.tiff with (2, 542, 1749) shape
No description has been provided for this image
In [3]:
from IPython.display import HTML
from ipywidgets import Output
import matplotlib.pyplot as plt


from ipywidgets import Output, VBox, Layout
import matplotlib.pyplot as plt
from IPython.display import display

# Create an output container for the audio widget with a left offset.
audio_style = "<style>audio { width: 100%; }</style>"
display(HTML(audio_style))
bad_vocal.audio()

fig = plt.figure(figsize=(6, 5))
bad_vocal.show(fig)
Your browser does not support the audio element.
No description has been provided for this image

Vocal repair - modified¶

In [5]:
# Load the bad_vocal.tiff file
from IPython.display import HTML
bad_vocal_r = NSGData.from_tiff("./edited/bad_vocal.tiff")

# Display audio player
display(HTML("<style>audio { width: 100%; }</style>"))
bad_vocal_r.audio()
bad_vocal_r.show()
Importing tiff c with shape:  torch.Size([2, 542, 1749])
torch.Size([542, 1749])
c:\Projects\nsgt-3\src\frame.py:83: UserWarning: Q-factor too high for frequencies 10.00,10.15,10.29,10.44,10.59,10.75,10.91,11.06,11.22,11.39,11.55,11.72,11.89,12.06,12.24,12.42,12.60,12.78,12.97,13.16,13.35,13.54,13.74,13.94,14.14,14.35,14.56,14.77,14.98,15.20,15.42,15.65,15.87,16.10,16.34,16.58,16.82,17.06,17.31,17.56,17.82,18.08,18.34,18.61,18.88,19.15,19.43,19.71,20.00,20.29,20.59,20.88,21.19,21.50,21.81,22.13,22.45,22.78,23.11,23.44,23.78,24.13,24.48,24.84,25.20,25.56,25.94,26.31,26.70,27.08,27.48,27.88,28.28,28.69,29.11,29.54,29.97,30.40,30.84,31.29,31.75,32.21,32.68,33.15,33.63,34.12,34.62,35.12,35.63,36.15,36.68,37.21,37.75,38.30,38.86,39.42,40.00,40.58,41.17,41.77,42.38,42.99,43.62,44.25,44.90,45.55,46.21,46.88,47.57,48.26,48.96,49.67,50.39,51.13,51.87,52.63,53.39,54.17,54.96,55.75,56.57,57.39,58.22,59.07,59.93,60.80,61.68,62.58,63.49,64.42,65.35,66.30,67.27,68.25,69.24,70.25,71.27,72.30,73.36,74.42,75.50,76.60,77.72,78.85,79.99,81.16,82.34,83.54,84.75,85.98,87.23,88.50,89.79,91.10,92.42,93.77,95.13,96.51,97.92,99.34,100.79,102.25,103.74,105.25,106.78
  warn("Q-factor too high for frequencies %s"%",".join("%.2f"%fi for fi in f[q >= qneeded]))
Your browser does not support the audio element.
No description has been provided for this image

Masking - original¶

In [6]:
electro_masking = NSGData.from_wav("./samples/electro_masking.wav", 
GaborSystemParams(
    scale=Oct,
    n_b=120,
    fmin=28,
    fmax=24000,
    fs=None,
    Ls=None,
    reducedform=0
))

electro_masking.to_tiff("./images/electro.tiff", colormode="miniswhite")


electro_masking.show()
c:\Projects\nsgt-3\src\frame.py:83: UserWarning: Q-factor too high for frequencies 28.00,28.16,28.33,28.49,28.65,28.82,28.99,29.15,29.32,29.49,29.66,29.84,30.01,30.18,30.36,30.53,30.71,30.89,31.07,31.25,31.43,31.61,31.79,31.98,32.16,32.35,32.53,32.72,32.91,33.10,33.29,33.49,33.68,33.88,34.07,34.27,34.47,34.67,34.87,35.07,35.27,35.48,35.68,35.89,36.10,36.31,36.52,36.73,36.94,37.15,37.37,37.58,37.80,38.02,38.24,38.46,38.69,38.91,39.13,39.36,39.59,39.82,40.05,40.28,40.51,40.75,40.98,41.22,41.46,41.70,41.94,42.18,42.43,42.67,42.92,43.17,43.42,43.67,43.92,44.18,44.43,44.69,44.95,45.21,45.47,45.73,46.00,46.27,46.53,46.80,47.07,47.35,47.62,47.90,48.17,48.45,48.73,49.01,49.30,49.58,49.87,50.16,50.45,50.74,51.04,51.33,51.63,51.93,52.23,52.53,52.83,53.14,53.45,53.76,54.07,54.38,54.70,55.01,55.33,55.65,55.97,56.30,56.62,56.95,57.28,57.61,57.95,58.28,58.62,58.96,59.30,59.64,59.99,60.34,60.69,61.04,61.39,61.75,62.10,62.46,62.82,63.19,63.55,63.92,64.29,64.66,65.04,65.41,65.79,66.17,66.56,66.94,67.33,67.72,68.11,68.51,68.90,69.30,69.70,70.11,70.51,70.92,71.33,71.74,72.16,72.58,73.00,73.42,73.84,74.27,74.70,75.13,75.57,76.01,76.45,76.89,77.33,77.78,78.23,78.69,79.14,79.60,80.06,80.52,80.99,81.46,81.93,82.40,82.88,83.36,83.84,84.33,84.82,85.31,85.80,86.30,86.80,87.30,87.81,88.31,88.83,89.34,89.86,90.38,90.90,91.43,91.96,92.49,93.02,93.56,94.10,94.65,95.20,95.75,96.30,96.86,97.42
  warn("Q-factor too high for frequencies %s"%",".join("%.2f"%fi for fi in f[q >= qneeded]))
torch.Size([2, 1172, 1951])
Saved complex spectrogram to ./images/electro.tiff with (2, 1172, 1951) shape
No description has been provided for this image

Masked version - edited¶

In [8]:
masking_edited = NSGData.from_tiff("./edited/masking.tiff")
masking_edited.audio()
masking_edited.show()
Importing tiff c with shape:  torch.Size([2, 1172, 1951])
torch.Size([1172, 1951])
c:\Projects\nsgt-3\src\frame.py:83: UserWarning: Q-factor too high for frequencies 28.00,28.16,28.33,28.49,28.65,28.82,28.99,29.15,29.32,29.49,29.66,29.84,30.01,30.18,30.36,30.53,30.71,30.89,31.07,31.25,31.43,31.61,31.79,31.98,32.16,32.35,32.53,32.72,32.91,33.10,33.29,33.49,33.68,33.88,34.07,34.27,34.47,34.67,34.87,35.07,35.27,35.48,35.68,35.89,36.10,36.31,36.52,36.73,36.94,37.15,37.37,37.58,37.80,38.02,38.24,38.46,38.69,38.91,39.13,39.36,39.59,39.82,40.05,40.28,40.51,40.75,40.98,41.22,41.46,41.70,41.94,42.18,42.43,42.67,42.92,43.17,43.42,43.67,43.92,44.18,44.43,44.69,44.95,45.21,45.47,45.73,46.00,46.27,46.53,46.80,47.07,47.35,47.62,47.90,48.17,48.45,48.73,49.01,49.30,49.58,49.87,50.16,50.45,50.74,51.04,51.33,51.63,51.93,52.23,52.53,52.83,53.14,53.45,53.76,54.07,54.38,54.70,55.01,55.33,55.65,55.97,56.30,56.62,56.95,57.28,57.61,57.95,58.28,58.62,58.96,59.30,59.64,59.99,60.34,60.69,61.04,61.39,61.75,62.10,62.46,62.82,63.19,63.55,63.92,64.29,64.66,65.04,65.41,65.79,66.17,66.56,66.94,67.33,67.72,68.11,68.51,68.90,69.30,69.70,70.11,70.51,70.92,71.33,71.74,72.16,72.58,73.00,73.42,73.84,74.27,74.70,75.13,75.57,76.01,76.45,76.89,77.33,77.78,78.23,78.69,79.14,79.60,80.06,80.52,80.99,81.46,81.93,82.40,82.88,83.36,83.84,84.33,84.82,85.31,85.80,86.30,86.80,87.30,87.81,88.31,88.83,89.34,89.86,90.38,90.90,91.43,91.96,92.49,93.02,93.56,94.10,94.65,95.20,95.75,96.30,96.86,97.42
  warn("Q-factor too high for frequencies %s"%",".join("%.2f"%fi for fi in f[q >= qneeded]))
Your browser does not support the audio element.
No description has been provided for this image

Partial transposition¶

In [10]:
transpose_edited = NSGData.from_tiff("./edited/transpose.tiff")
transpose_edited.audio()
transpose_edited.show()
Importing tiff c with shape:  torch.Size([2, 1172, 1951])
torch.Size([1172, 1951])
Your browser does not support the audio element.
No description has been provided for this image

Partial Transposition - 2¶

In [ ]:
transpose_edited_2 = NSGData.from_tiff("./edited/transpose_2.tiff")
transpose_edited_2.audio()
transpose_edited_2.show()
Importing tiff c with shape:  torch.Size([2, 1172, 1951])
torch.Size([1172, 1951])
c:\Projects\nsgt-3\src\frame.py:83: UserWarning: Q-factor too high for frequencies 28.00,28.16,28.33,28.49,28.65,28.82,28.99,29.15,29.32,29.49,29.66,29.84,30.01,30.18,30.36,30.53,30.71,30.89,31.07,31.25,31.43,31.61,31.79,31.98,32.16,32.35,32.53,32.72,32.91,33.10,33.29,33.49,33.68,33.88,34.07,34.27,34.47,34.67,34.87,35.07,35.27,35.48,35.68,35.89,36.10,36.31,36.52,36.73,36.94,37.15,37.37,37.58,37.80,38.02,38.24,38.46,38.69,38.91,39.13,39.36,39.59,39.82,40.05,40.28,40.51,40.75,40.98,41.22,41.46,41.70,41.94,42.18,42.43,42.67,42.92,43.17,43.42,43.67,43.92,44.18,44.43,44.69,44.95,45.21,45.47,45.73,46.00,46.27,46.53,46.80,47.07,47.35,47.62,47.90,48.17,48.45,48.73,49.01,49.30,49.58,49.87,50.16,50.45,50.74,51.04,51.33,51.63,51.93,52.23,52.53,52.83,53.14,53.45,53.76,54.07,54.38,54.70,55.01,55.33,55.65,55.97,56.30,56.62,56.95,57.28,57.61,57.95,58.28,58.62,58.96,59.30,59.64,59.99,60.34,60.69,61.04,61.39,61.75,62.10,62.46,62.82,63.19,63.55,63.92,64.29,64.66,65.04,65.41,65.79,66.17,66.56,66.94,67.33,67.72,68.11,68.51,68.90,69.30,69.70,70.11,70.51,70.92,71.33,71.74,72.16,72.58,73.00,73.42,73.84,74.27,74.70,75.13,75.57,76.01,76.45,76.89,77.33,77.78,78.23,78.69,79.14,79.60,80.06,80.52,80.99,81.46,81.93,82.40,82.88,83.36,83.84,84.33,84.82,85.31,85.80,86.30,86.80,87.30,87.81,88.31,88.83,89.34,89.86,90.38,90.90,91.43,91.96,92.49,93.02,93.56,94.10,94.65,95.20,95.75,96.30,96.86,97.42
  warn("Q-factor too high for frequencies %s"%",".join("%.2f"%fi for fi in f[q >= qneeded]))
Your browser does not support the audio element.
No description has been provided for this image

Spectral distortion¶

In [12]:
electro_perspective = NSGData.from_tiff("./edited/warped.tiff")
electro_perspective.audio()
electro_perspective.show()
Importing tiff c with shape:  torch.Size([2, 588, 3894])
torch.Size([588, 3894])
c:\Projects\nsgt-3\src\frame.py:83: UserWarning: Q-factor too high for frequencies 28.00,28.33,28.65,28.99,29.32,29.66,30.01,30.36,30.71,31.07,31.43,31.79,32.16,32.53,32.91,33.29,33.68,34.07,34.47,34.87,35.27,35.68,36.10,36.52,36.94,37.37,37.80,38.24,38.69,39.13,39.59,40.05,40.51,40.98,41.46,41.94,42.43,42.92,43.42,43.92,44.43,44.95,45.47,46.00,46.53,47.07,47.62,48.17,48.73
  warn("Q-factor too high for frequencies %s"%",".join("%.2f"%fi for fi in f[q >= qneeded]))
Your browser does not support the audio element.
No description has been provided for this image

Phase preserved transpose effects¶

In [13]:
electro = NSGData.from_wav("./samples/electro_masking.wav",
GaborSystemParams(
    scale=Oct,
    n_b=120,
    fmin=28,
    fmax=24000,
    fs=None,
    Ls=None,
    reducedform=0
))

electro.to_tiff("./images/electro.tiff", colormode="rgb")
electro.show()
c:\Projects\nsgt-3\src\frame.py:83: UserWarning: Q-factor too high for frequencies 28.00,28.16,28.33,28.49,28.65,28.82,28.99,29.15,29.32,29.49,29.66,29.84,30.01,30.18,30.36,30.53,30.71,30.89,31.07,31.25,31.43,31.61,31.79,31.98,32.16,32.35,32.53,32.72,32.91,33.10,33.29,33.49,33.68,33.88,34.07,34.27,34.47,34.67,34.87,35.07,35.27,35.48,35.68,35.89,36.10,36.31,36.52,36.73,36.94,37.15,37.37,37.58,37.80,38.02,38.24,38.46,38.69,38.91,39.13,39.36,39.59,39.82,40.05,40.28,40.51,40.75,40.98,41.22,41.46,41.70,41.94,42.18,42.43,42.67,42.92,43.17,43.42,43.67,43.92,44.18,44.43,44.69,44.95,45.21,45.47,45.73,46.00,46.27,46.53,46.80,47.07,47.35,47.62,47.90,48.17,48.45,48.73,49.01,49.30,49.58,49.87,50.16,50.45,50.74,51.04,51.33,51.63,51.93,52.23,52.53,52.83,53.14,53.45,53.76,54.07,54.38,54.70,55.01,55.33,55.65,55.97,56.30,56.62,56.95,57.28,57.61,57.95,58.28,58.62,58.96,59.30,59.64,59.99,60.34,60.69,61.04,61.39,61.75,62.10,62.46,62.82,63.19,63.55,63.92,64.29,64.66,65.04,65.41,65.79,66.17,66.56,66.94,67.33,67.72,68.11,68.51,68.90,69.30,69.70,70.11,70.51,70.92,71.33,71.74,72.16,72.58,73.00,73.42,73.84,74.27,74.70,75.13,75.57,76.01,76.45,76.89,77.33,77.78,78.23,78.69,79.14,79.60,80.06,80.52,80.99,81.46,81.93,82.40,82.88,83.36,83.84,84.33,84.82,85.31,85.80,86.30,86.80,87.30,87.81,88.31,88.83,89.34,89.86,90.38,90.90,91.43,91.96,92.49,93.02,93.56,94.10,94.65,95.20,95.75,96.30,96.86,97.42
  warn("Q-factor too high for frequencies %s"%",".join("%.2f"%fi for fi in f[q >= qneeded]))
torch.Size([1172, 1951, 3])
Saved complex spectrogram to ./images/electro.tiff with (1172, 1951, 3) shape
No description has been provided for this image
In [14]:
electro_edited = NSGData.from_tiff("./edited/transpose_rgb.tiff")
electro_edited.audio()
electro_edited.show()
c:\Projects\nsgt-3\src\frame.py:83: UserWarning: Q-factor too high for frequencies 28.00,28.16,28.33,28.49,28.65,28.82,28.99,29.15,29.32,29.49,29.66,29.84,30.01,30.18,30.36,30.53,30.71,30.89,31.07,31.25,31.43,31.61,31.79,31.98,32.16,32.35,32.53,32.72,32.91,33.10,33.29,33.49,33.68,33.88,34.07,34.27,34.47,34.67,34.87,35.07,35.27,35.48,35.68,35.89,36.10,36.31,36.52,36.73,36.94,37.15,37.37,37.58,37.80,38.02,38.24,38.46,38.69,38.91,39.13,39.36,39.59,39.82,40.05,40.28,40.51,40.75,40.98,41.22,41.46,41.70,41.94,42.18,42.43,42.67,42.92,43.17,43.42,43.67,43.92,44.18,44.43,44.69,44.95,45.21,45.47,45.73,46.00,46.27,46.53,46.80,47.07,47.35,47.62,47.90,48.17,48.45,48.73,49.01,49.30,49.58,49.87,50.16,50.45,50.74,51.04,51.33,51.63,51.93,52.23,52.53,52.83,53.14,53.45,53.76,54.07,54.38,54.70,55.01,55.33,55.65,55.97,56.30,56.62,56.95,57.28,57.61,57.95,58.28,58.62,58.96,59.30,59.64,59.99,60.34,60.69,61.04,61.39,61.75,62.10,62.46,62.82,63.19,63.55,63.92,64.29,64.66,65.04,65.41,65.79,66.17,66.56,66.94,67.33,67.72,68.11,68.51,68.90,69.30,69.70,70.11,70.51,70.92,71.33,71.74,72.16,72.58,73.00,73.42,73.84,74.27,74.70,75.13,75.57,76.01,76.45,76.89,77.33,77.78,78.23,78.69,79.14,79.60,80.06,80.52,80.99,81.46,81.93,82.40,82.88,83.36,83.84,84.33,84.82,85.31,85.80,86.30,86.80,87.30,87.81,88.31,88.83,89.34,89.86,90.38,90.90,91.43,91.96,92.49,93.02,93.56,94.10,94.65,95.20,95.75,96.30,96.86,97.42
  warn("Q-factor too high for frequencies %s"%",".join("%.2f"%fi for fi in f[q >= qneeded]))
Your browser does not support the audio element.
No description has been provided for this image

Erasing harmonics¶

In [15]:
erasure = NSGData.from_wav("./samples/erasure.wav",
GaborSystemParams(
    scale=Oct,
    n_b=120,
    fmin=28,
    fmax=24000,
    fs=None,
    Ls=None,
    reducedform=0 
))

erasure.to_tiff("./images/erasure.tiff", colormode="miniswhite")
erasure.audio()
erasure.show()
c:\Projects\nsgt-3\src\frame.py:83: UserWarning: Q-factor too high for frequencies 28.00,28.16,28.33,28.49,28.65,28.82,28.99,29.15,29.32,29.49,29.66,29.84,30.01,30.18,30.36,30.53,30.71,30.89,31.07,31.25,31.43,31.61,31.79,31.98,32.16,32.35,32.53,32.72,32.91,33.10,33.29,33.49,33.68,33.88,34.07,34.27,34.47,34.67,34.87,35.07,35.27,35.48,35.68,35.89,36.10,36.31,36.52,36.73,36.94,37.15,37.37,37.58,37.80,38.02,38.24,38.46,38.69,38.91,39.13,39.36,39.59,39.82,40.05,40.28,40.51,40.75,40.98,41.22,41.46,41.70,41.94,42.18,42.43,42.67,42.92,43.17,43.42
  warn("Q-factor too high for frequencies %s"%",".join("%.2f"%fi for fi in f[q >= qneeded]))
torch.Size([2, 1172, 4373])
Saved complex spectrogram to ./images/erasure.tiff with (2, 1172, 4373) shape
Your browser does not support the audio element.
No description has been provided for this image
In [16]:
erasure_edited = NSGData.from_tiff("./edited/erasure.tiff")
erasure_edited.audio()
erasure_edited.show()
Importing tiff c with shape:  torch.Size([2, 1172, 4373])
torch.Size([1172, 4373])
c:\Projects\nsgt-3\src\frame.py:83: UserWarning: Q-factor too high for frequencies 28.00,28.16,28.33,28.49,28.65,28.82,28.99,29.15,29.32,29.49,29.66,29.84,30.01,30.18,30.36,30.53,30.71,30.89,31.07,31.25,31.43,31.61,31.79,31.98,32.16,32.35,32.53,32.72,32.91,33.10,33.29,33.49,33.68,33.88,34.07,34.27,34.47,34.67,34.87,35.07,35.27,35.48,35.68,35.89,36.10,36.31,36.52,36.73,36.94,37.15,37.37,37.58,37.80,38.02,38.24,38.46,38.69,38.91,39.13,39.36,39.59,39.82,40.05,40.28,40.51,40.75,40.98,41.22,41.46,41.70,41.94,42.18,42.43,42.67,42.92,43.17,43.42
  warn("Q-factor too high for frequencies %s"%",".join("%.2f"%fi for fi in f[q >= qneeded]))
Your browser does not support the audio element.
No description has been provided for this image

Pitch sliding¶

In [17]:
quack = NSGData.from_wav("./samples/quack.wav", 
GaborSystemParams(
    scale=Oct,
    n_b=60,
    fmin=28,
    fmax=24000,
    fs=None,
    Ls=None,
    reducedform=0
)) 

quack.to_tiff("./images/quack.tiff")
quack.audio()
quack.show()
c:\Projects\nsgt-3\src\frame.py:83: UserWarning: Q-factor too high for frequencies 28.00,28.33,28.65,28.99,29.32,29.66,30.01,30.36,30.71,31.07,31.43,31.79,32.16,32.53,32.91,33.29,33.68,34.07,34.47,34.87,35.27,35.68,36.10,36.52,36.94,37.37,37.80,38.24,38.69,39.13,39.59,40.05,40.51,40.98,41.46,41.94,42.43,42.92,43.42,43.92,44.43,44.95,45.47,46.00,46.53,47.07,47.62,48.17,48.73,49.30,49.87,50.45,51.04,51.63,52.23,52.83,53.45,54.07,54.70,55.33,55.97,56.62,57.28,57.95,58.62,59.30,59.99,60.68,61.39,62.10,62.82,63.55,64.29,65.04,65.79,66.56,67.33,68.11,68.90,69.70,70.51,71.33,72.16,73.00,73.84,74.70,75.57,76.45,77.33,78.23,79.14,80.06,80.99,81.93,82.88,83.84,84.82,85.80,86.80,87.80,88.82,89.86,90.90,91.95,93.02,94.10,95.20,96.30,97.42,98.55,99.69,100.85,102.02,103.21,104.41,105.62,106.84,108.09,109.34,110.61,111.89,113.19,114.51,115.84,117.18,118.54,119.92,121.31,122.72,124.15,125.59,127.05,128.52,130.01,131.52,133.05,134.59,136.16,137.74,139.34,140.96,142.59,144.25,145.92,147.62,149.33,151.07,152.82,154.59,156.39,158.20,160.04,161.90,163.78,165.68,167.61,169.55,171.52,173.51,175.53,177.56,179.63,181.71,183.82,185.96,188.12,190.30,192.51,194.75,197.01,199.29,201.61,203.95,206.32,208.71,211.14,213.59,216.07,218.58,221.11,223.68,226.28,228.91,231.56,234.25,236.97,239.73,242.51,245.32,248.17,251.06,253.97,256.92,259.90,262.92,265.97,269.06,272.19,275.35,278.54,281.78,285.05,288.36,291.71
  warn("Q-factor too high for frequencies %s"%",".join("%.2f"%fi for fi in f[q >= qneeded]))
torch.Size([2, 580, 591])
Saved complex spectrogram to ./images/quack.tiff with (2, 580, 591) shape
Your browser does not support the audio element.
No description has been provided for this image
In [18]:
quack_edited = NSGData.from_tiff("./edited/quack.tiff")
quack_edited.audio()
quack_edited.show()
Importing tiff c with shape:  torch.Size([2, 580, 591])
torch.Size([580, 591])
c:\Projects\nsgt-3\src\frame.py:83: UserWarning: Q-factor too high for frequencies 28.00,28.33,28.65,28.99,29.32,29.66,30.01,30.36,30.71,31.07,31.43,31.79,32.16,32.53,32.91,33.29,33.68,34.07,34.47,34.87,35.27,35.68,36.10,36.52,36.94,37.37,37.80,38.24,38.69,39.13,39.59,40.05,40.51,40.98,41.46,41.94,42.43,42.92,43.42,43.92,44.43,44.95,45.47,46.00,46.53,47.07,47.62,48.17,48.73,49.30,49.87,50.45,51.04,51.63,52.23,52.83,53.45,54.07,54.70,55.33,55.97,56.62,57.28,57.95,58.62,59.30,59.99,60.68,61.39,62.10,62.82,63.55,64.29,65.04,65.79,66.56,67.33,68.11,68.90,69.70,70.51,71.33,72.16,73.00,73.84,74.70,75.57,76.45,77.33,78.23,79.14,80.06,80.99,81.93,82.88,83.84,84.82,85.80,86.80,87.80,88.82,89.86,90.90,91.95,93.02,94.10,95.20,96.30,97.42,98.55,99.69,100.85,102.02,103.21,104.41,105.62,106.84,108.09,109.34,110.61,111.89,113.19,114.51,115.84,117.18,118.54,119.92,121.31,122.72,124.15,125.59,127.05,128.52,130.01,131.52,133.05,134.59,136.16,137.74,139.34,140.96,142.59,144.25,145.92,147.62,149.33,151.07,152.82,154.59,156.39,158.20,160.04,161.90,163.78,165.68,167.61,169.55,171.52,173.51,175.53,177.56,179.63,181.71,183.82,185.96,188.12,190.30,192.51,194.75,197.01,199.29,201.61,203.95,206.32,208.71,211.14,213.59,216.07,218.58,221.11,223.68,226.28,228.91,231.56,234.25,236.97,239.73,242.51,245.32,248.17,251.06,253.97,256.92,259.90,262.92,265.97,269.06,272.19,275.35,278.54,281.78,285.05,288.36,291.71
  warn("Q-factor too high for frequencies %s"%",".join("%.2f"%fi for fi in f[q >= qneeded]))
Your browser does not support the audio element.
No description has been provided for this image

Altering Harmonics¶

In [28]:
# Load a sample and convert to NSGT
reharmonise = NSGData.from_wav("./samples/reharmonise.wav", 
    GaborSystemParams(
        scale=Oct,
        n_b=60,
        fmin=28,
        fmax=24000,
        fs=None,
        Ls=None,
        reducedform=0
    )
) 

# Save to TIFF for potential editing
reharmonise.to_tiff("./images/reharmonise.tiff")
reharmonise.audio()
reharmonise.show()
c:\Projects\nsgt-3\src\frame.py:83: UserWarning: Q-factor too high for frequencies 28.00,28.33,28.65,28.99,29.32,29.66,30.01,30.36,30.71,31.07,31.43
  warn("Q-factor too high for frequencies %s"%",".join("%.2f"%fi for fi in f[q >= qneeded]))
torch.Size([2, 588, 6026])
Saved complex spectrogram to ./images/reharmonise.tiff with (2, 588, 6026) shape
Your browser does not support the audio element.
No description has been provided for this image
In [29]:
reharmonise_edited = NSGData.from_tiff("./edited/reharmonise.tiff")
reharmonise_edited.audio()
reharmonise_edited.show()
Importing tiff c with shape:  torch.Size([2, 588, 6026])
torch.Size([588, 6026])
c:\Projects\nsgt-3\src\frame.py:83: UserWarning: Q-factor too high for frequencies 28.00,28.33,28.65,28.99,29.32,29.66,30.01,30.36,30.71,31.07,31.43
  warn("Q-factor too high for frequencies %s"%",".join("%.2f"%fi for fi in f[q >= qneeded]))
Your browser does not support the audio element.
No description has been provided for this image
In [30]:
# Load a sample and convert to NSGT
reharmonise = NSGData.from_wav("./samples/reharmonise_1.wav", 
    GaborSystemParams(
        scale=Oct,
        n_b=60,
        fmin=28,
        fmax=24000,
        fs=None,
        Ls=None,
        reducedform=0
    )
) 

# Save to TIFF for potential editing
reharmonise.to_tiff("./images/reharmonise_1.tiff")
reharmonise.audio()
reharmonise.show()
c:\Projects\nsgt-3\src\frame.py:83: UserWarning: Q-factor too high for frequencies 28.00,28.33,28.65,28.99,29.32,29.66,30.01,30.36,30.71,31.07,31.43,31.79,32.16,32.53,32.91,33.29,33.68,34.07,34.47,34.87,35.27,35.68,36.10,36.52,36.94,37.37,37.80,38.24,38.69,39.13,39.59,40.05,40.51,40.98,41.46,41.94,42.43,42.92,43.42,43.92,44.43,44.95,45.47,46.00,46.53,47.07,47.62,48.17,48.73,49.30,49.87,50.45,51.04,51.63,52.23,52.83,53.45,54.07,54.70
  warn("Q-factor too high for frequencies %s"%",".join("%.2f"%fi for fi in f[q >= qneeded]))
torch.Size([2, 588, 3467])
Saved complex spectrogram to ./images/reharmonise_1.tiff with (2, 588, 3467) shape
Your browser does not support the audio element.
No description has been provided for this image
In [26]:
reharmonise_edited = NSGData.from_tiff("./edited/reharmonise_1.tiff")
reharmonise_edited.audio()
reharmonise_edited.show()
Importing tiff c with shape:  torch.Size([2, 588, 3467])
torch.Size([588, 3467])
c:\Projects\nsgt-3\src\frame.py:83: UserWarning: Q-factor too high for frequencies 28.00,28.33,28.65,28.99,29.32,29.66,30.01,30.36,30.71,31.07,31.43,31.79,32.16,32.53,32.91,33.29,33.68,34.07,34.47,34.87,35.27,35.68,36.10,36.52,36.94,37.37,37.80,38.24,38.69,39.13,39.59,40.05,40.51,40.98,41.46,41.94,42.43,42.92,43.42,43.92,44.43,44.95,45.47,46.00,46.53,47.07,47.62,48.17,48.73,49.30,49.87,50.45,51.04,51.63,52.23,52.83,53.45,54.07,54.70
  warn("Q-factor too high for frequencies %s"%",".join("%.2f"%fi for fi in f[q >= qneeded]))
Your browser does not support the audio element.
No description has been provided for this image

Instrument isolation with time-stretching¶

In [31]:
# Load a sample and convert to NSGT
trumpet = NSGData.from_wav("./samples/trumpet.wav", 
    GaborSystemParams(
        scale=Oct,
        n_b=60,
        fmin=28,
        fmax=24000,
        fs=None,
        Ls=None,
        reducedform=0
    )
) 

# Save to TIFF for potential editing
trumpet.to_tiff("./images/trumpet.tiff")
trumpet.audio()
trumpet.show()
c:\Projects\nsgt-3\src\frame.py:83: UserWarning: Q-factor too high for frequencies 28.00,28.33,28.65,28.99,29.32,29.66,30.01,30.36
  warn("Q-factor too high for frequencies %s"%",".join("%.2f"%fi for fi in f[q >= qneeded]))
torch.Size([2, 588, 6217])
Saved complex spectrogram to ./images/trumpet.tiff with (2, 588, 6217) shape
Your browser does not support the audio element.
No description has been provided for this image
In [32]:
trumpet_edited = NSGData.from_tiff("./edited/trumpet.tiff")
trumpet_edited.audio()
trumpet_edited.show()
Importing tiff c with shape:  torch.Size([2, 588, 6217])
torch.Size([588, 6217])
c:\Projects\nsgt-3\src\frame.py:83: UserWarning: Q-factor too high for frequencies 28.00,28.33,28.65,28.99,29.32,29.66,30.01,30.36
  warn("Q-factor too high for frequencies %s"%",".join("%.2f"%fi for fi in f[q >= qneeded]))
Your browser does not support the audio element.
No description has been provided for this image